package com.lu.manage.modular.system.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.lu.manage.core.common.node.TreeNodes;
import com.lu.manage.core.common.node.ZTreeNode;
import com.lu.manage.modular.system.model.Menu;
import com.lu.manage.modular.system.model.dto.MenuDto;

import java.util.List;
import java.util.Map;

public interface MenuService extends IService<Menu> {

    List<String> findPermissionsByRoleId(String roleId);

    List<TreeNodes> getMenusByRolesIds(List<String> roleList);

    List<Map<String, Object>> selectMenuTree(String searchWords, String level);

    List<ZTreeNode> menuTreeList();

    /**
     * 编号唯一性、编号和父编号不能相同
     * @param menu
     * @throws Exception
     */
    MenuDto add(MenuDto menu) throws Exception;

    /**
     * 更新菜单
     * @param menuDto
     * @throws Exception
     */
    void update(MenuDto menuDto) throws Exception;

    /**
     * 删除菜单包含所有子菜单
     * @param menuId
     * @throws Exception
     */
    void deleteMenuSubMenus(String menuId) throws Exception;

    /**
     * 对所有菜单，重新排序
     * @param nodes
     * @throws Exception
     */
    void sortAllMenus(String nodes) throws Exception;

    /**
     * 根据条件查询菜单
     * @param roleId
     * @return
     * @throws Exception
     */
    List<String> getMenuIdsByRoleId(String roleId) throws Exception;

    /**
     * 获取菜单列表树
     * @param menuIds
     * @return
     * @throws Exception
     */
    List<ZTreeNode> menuTreeListByMenuIds(List<String> menuIds) throws Exception;

}
